package com.ns.sbs.oauth.role4permission.entry;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ns.core.utils.StpUtil;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
@Accessors(chain = true)
@TableName(value = "KERNEL_ROLE_PERMISSION")
public class RolePermission implements Serializable {

    @Serial
    private static final Long serialVersionUID = 1L;

    /**
     * 此模块对应的表名
     */
    public static final String TABLE_NAME = "KERNEL_ROLE_PERMISSION";
    /**
     * 唯一标识
     */
    @TableId(type = IdType.AUTO)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * 租户名称
     */
    private Long roleId;
    /**
     * 菜单id
     */
    private Long permission;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 创建人
     */
    private Long creator = StpUtil.getLoginUserId();
}
